import http from '@/http';

const url = '/api/userSystem/userInfo';

// 获取用户权限
export async function getUserPermission(options = {}) {
  return await http.request('get', `${ url }/functions`, options).then(res => {
    if (!options.waitingMask) {
      http.tip(res);
    }
    return res;
  });
}
// 获取用户信息
export async function getUserInfo(options = {}) {
  return await http.request('get', url, options).then(res => {
    if (!options.waitingMask) {
      http.tip(res);
    }
    return res;
  });
}
// 修改用户信息
export async function editUserInfo(options = {}) {
  return await http.request('put', url, options).then(res => {
    if (res.code == 200) {
      res.message = '修改成功';
    }
    if (!options.waitingMask) {
      http.tip(res);
    }
    return res;
  });
}
// 修改用户密码
export async function editPassword(options = {}) {
  return await http.request('put', `${ url }/password`, options).then(res => {
    if (!options.waitingMask) {
      http.tip(res);
    }
    return res;
  });
}
